<?php
    include 'init.php';

    //相册创建时间
    $create_time = time();


    //接收相册名称
    $name = $_POST['name'];

    //判断相册名称是否为空
    if($name == ''){
        redirect('相册名称不能为空', $_SERVER['HTTP_REFERER']);
    }

    $user_id = $_SESSION['admin']['id'];
    $sql = "insert into album values(null, '$user_id', '$name', '$create_time')";

    if(mysql_query($sql)){
        redirect('相册创建成功','index.php');
    }else{
        redirect('相册创建失败',$_SERVER['HTTP_REFERER']);
    }

    mysql_close($link);
